home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / credit1a / frmmain.frm (.txt) < prev    next >
Visual Basic Form  |  1999-08-28  |  2KB  |  56 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00000000&
  5.    Caption         =   "VBCredits"
  6.    ClientHeight    =   3690
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   5940
  10.    BeginProperty Font 
  11.       Name            =   "Fixedsys"
  12.       Size            =   9
  13.       Charset         =   0
  14.       Weight          =   400
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H00FFFFFF&
  20.    LinkTopic       =   "Form1"
  21.    ScaleHeight     =   246
  22.    ScaleMode       =   3  'Pixel
  23.    ScaleWidth      =   396
  24.    StartUpPosition =   3  'Windows Default
  25. Attribute VB_Name = "frmMain"
  26. Attribute VB_GlobalNameSpace = False
  27. Attribute VB_Creatable = False
  28. Attribute VB_PredeclaredId = True
  29. Attribute VB_Exposed = False
  30. Dim myCredits As New cCredits ' The credits object
  31. Private Sub Form_Load()
  32.   ' Frame limiter
  33.   Dim CurTime As Long, NextTime As Long
  34.   Me.Show ' ALWAYS make sure the form is shown before entering a loop
  35.   myCredits.PosY = Me.ScaleHeight ' Set the Y position of the credits
  36.   LoadTXT ' call sub to load the text in the text file into the VBCredits strings
  37.   Do While DoEvents() ' Do until the program ends
  38.     CurTime = timeGetTime() ' Get the current time
  39.     If CurTime >= NextTime Then ' If the time is right to execute the next frame
  40.       Me.Cls
  41.       ' Draw the credits onto the form
  42.       myCredits.Draw Me.hDC, Me.ScaleWidth, Me.ScaleHeight
  43.       NextTime = CurTime + 50 ' Set when the next frame should be executed
  44.     End If
  45.   Loop
  46. End Sub
  47. Public Sub LoadTXT()
  48.   ReDim Strings(0) ' Resize the strings array to no strings
  49.   Open App.Path & "\credits.txt" For Input As #1 ' Open the text file
  50.   Do Until EOF(1) ' Repeat until the end of the file
  51.     ReDim Preserve Strings(UBound(Strings) + 1) ' Resize the array preserving the current entries
  52.     Input #1, Strings(UBound(Strings)) ' Load in the string
  53.   Loop
  54.   Close #1 ' Close the text file
  55. End Sub
  56.